package com.example.testapp;

import java.io.IOException;
import com.google.android.gcm.server.Message;
import com.google.android.gcm.server.Result;
import com.google.android.gcm.server.Sender;

import android.os.AsyncTask;


public class AsyncRequestPush extends AsyncTask<Void,Void,Void> {

	private String mpushMsg;
	private Sender mgcmSender;
	private Message mgcmMessage;
	private String mregistrationId;
	private Result mgcmResult;
	
	public AsyncRequestPush(String registrationId, Message gcmMessage, Sender gcmSender){
		mregistrationId = registrationId;
		mgcmMessage = gcmMessage;
		mgcmSender = gcmSender;
	}
	
	@Override
	protected Void doInBackground(Void... params) {
		// TODO Auto-generated method stub
		//setMessage(pushMsg);
		sendMessage();
		return null;
	}
	private void sendMessage() {
			// TODO Auto-generated method stub
	    	try {
				mgcmResult = mgcmSender.send(mgcmMessage,mregistrationId, 2);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
	}
	

}
